<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel=StyleSheet HREF="../stylesheet/stylesheet.css" TYPE="text/css" MEDIA=screen>
<title>Shop Management System</title>
<?php include('menu.php'); ?>
</head>
<body>
<?php
include("../connect/connect.php");

//แก้ไข
if($_GET["action"]=="update") {

	if($_POST['shop_name'] != "")
		{
			$Query = "UPDATE shopname SET shop_name = '".$_POST["shop_name"]."' WHERE shop_id = '1' ";
			$objQuery = mysql_query($Query);
			
			if($objQuery) {
				$save="บันทึกข้อมูลเรียบร้อยแล้ว";
				} else {
				echo "Error Save [".$Query."]";
				}
		} else {
		$save="ยังไม่ได้กรอกข้อมูล";
		}
}

$Query = "SELECT * FROM shopname WHERE shop_id = '1'";
$objQuery = mysql_query($Query) or die ("Error Query [".$Query."]");
$row = mysql_fetch_array($objQuery);
?>
<form action="?action=update" name="formedit" method="post" id="formedit">
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
    <div class="heading">
      <h1>จัดการชื่อร้านค้า</h1>
      <div class="buttons"><a onclick="formedit.submit();" class="button"><span>บันทึก</span></a><a onclick="location = 'product_manage_category.php';" class="button"><span>ยกเลิก</span></a></div></div>
  <div class="content">
    <table class="form">
      <tr>
        <td>ชื่อร้านค้าเดิม : </td>
        <td><?php echo $row["shop_name"];?></td>
      </tr>
      <tr>
        <td>ชื่อร้านค้าใหม่ : </td>
        <td><input name="shop_name" type="text" id="shop_name" /></td>
      </tr>
    </table>
	<?php echo "<br><font color=\"red\"><center>$save</center></font>"; ?>
  </div>
</div>
</form>
</body>
<?php mysql_close(); ?>
</html>
